var login = function(){
	$('#loginForm').form('submit',{
        url:'account/login.jx',
        dataType:'json',
        onSubmit:function(param){
            $.messager.progress({msg:'正在登录...'});
        },
        success:function(obj){
        	obj = $.parseJSON(obj);
        	$.successParser(obj);
            if(obj.success){
            	location.href = './';
            }
            $.messager.progress('close');
        },
        onLoadError:function(){
            $.messager.progress('close');
        }
    });
};
$(function(){
	$('#codeImg').click(function(){
        $(this).attr('src','code.html?'+Math.random());
    }).click();
	//登录
	$("#enter").click(login);
	$('#loginForm .text').keydown(function(e){
		if(e.keyCode == 13){
			login();
		}
	});
	$('#name').focus();
});